use strict;
use warnings;

# Delete old concatenated (train+test) files
my @files = ("NTDBNEW_Imputation_HD.txt","NTDBNEW_Imputation_LD.txt");
foreach my $file (@files)
{
    if(unlink($file) == 0)
    {
        print "File " . $file . " was NOT deleted.\n";
    }
    else
    {
        print "File " . $file . " deleted successfully.\n";
    }
}

#Concatenate train/test files for imputation
my $ALLHD = 'NTDBNEW_Imputation_HD.txt';
my $ALLLD = 'NTDBNEW_Imputation_LD.txt';

@ARGV = ('NTDBNEW_Imputation_Train_HD.txt', 'NTDBNEW_Imputation_Test_HD.txt');

open SEL, '>', $ALLHD or die $!;

while (<>) {
  print SEL;
}

@ARGV = ('NTDBNEW_Imputation_Train_LD.txt', 'NTDBNEW_Imputation_Test_LD.txt');

open SEL, '>', $ALLLD or die $!;

while (<>) {
  print SEL;
}

